package com.bw.mvvm_common.mvvm.network;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public
/**
 * @author Guan
 * @description:
 * @date :2021/9/8 0008 下午 4:40
 *
 */
class Uploadimpl implements Httpinterface{

    Retrofit retrofit;
    @Override
    public Retrofit getRetrofit() {

        OkHttpClient.Builder okBuilder = new OkHttpClient.Builder();
        HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY);
        okBuilder.addInterceptor(httpLoggingInterceptor);
        okBuilder.connectTimeout(30, TimeUnit.SECONDS);
        okBuilder.writeTimeout(60,TimeUnit.SECONDS);
        okBuilder.readTimeout(30,TimeUnit.SECONDS);
        Retrofit.Builder builder = new Retrofit.Builder();
        builder.client(okBuilder.build());
        builder.baseUrl(Api.basURl);
        builder.addCallAdapterFactory(RxJava2CallAdapterFactory.create());
        builder.addConverterFactory(GsonConverterFactory.create());
        retrofit = builder.build();
        return retrofit;

    }

}
